package com.woniu.adopt.mapper;

import com.woniu.adopt.entity.Activity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ActivityMapper {

    //根据id进行删除
    int deleteByPrimaryKey(Integer id);

    //添加团队活动
    int insert(Activity record);

    //根据id进行查询活动
    Activity selectByPrimaryKey(Integer id);

    //查询所有
    List<Activity> selectAll();

    //更新活动
    int updateByPrimaryKey(Activity record);

    //模糊查询 （活动名称，发布状态）+ 分页
    List<Activity> selectActivityByName(@Param("name") String name,@Param("address") String address, @Param("display") int display);

    //模糊查询 --历史（活动名称）+ 分页
    List<Activity> selectOldActivityByName(@Param("name") String name,@Param("address") String address, @Param("display") int display);

    @Select("select * from t_activity where id = #{id} ;")
    Activity queryActivityByKey(int id);

    @Update("update t_activity set del = -1 where id = #{id}")
    int updateByPrimaryKey2(int id);
}